package com.chao.error;

public enum  EnumError implements CommonError{
    PARAMETER_VALIDATION_ERROR(20001, "参数不合法"),
    PARAMETER_NONNULL_ERROR(20002, "参数不能为空"),
    USER_NOT_EXIST(30001, "用户不存在"),
    USER_ALREADY_EXIST(30002, "号码已注册"),
    USER_NOT_LOGIN(30003, "用户未登录"),
    USER_LOGIN_ERROR(30004, "用户/密码不正确"),
    PRODUCT_NOT_EXIST(40001, "商品不存在"),
    PRODUCT_NOT_ENOUGH(40002, "库存不足"),
    UNKNOWN_ERROR(10000, "未知错误");

    Integer errorCode;

    String errorMessage;

    EnumError(Integer errorCode, String errorMessage) {
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

    @Override
    public int getErrorCode() {
        return errorCode;
    }

    @Override
    public String getErrorMessage() {
        return errorMessage;
    }

    @Override
    public CommonError setErrorMessage(String message) {
        this.errorMessage = message;
        return this;
    }
}
